DeriveGamemode("sandbox"); // This makes the gamemode derive from sandbox EG gives the spawn menu and scoreboard

AddCSLuaFile("cl_init.lua");
AddCSLuaFile("shared.lua");

include("shared.lua");
include("sv_concommands.lua");
include("chat_commands.lua");


function GM:PlayerInitialSpawn(pl)
	
	pl:SetTeam( SPECTATE )
	pl:PrintMessage(HUD_PRINTCENTER,"Welcome to AtlantisRP!");
	
	if( pl:Team( ANCIENT ) ) then
	pl:PrintMessage(HUD_PRINTTALK,"You're an Ancient! Enjoy it Admins. You're the only ones who can.");
	else

	if( pl:Team( WRAITH )) then
	pl:PrintMessage(HUD_PRINTTALK,"You're a Wraith."); 
	
	else


	if( pl:Team( SG_TEAM )) then
	pl:PrintMessage(HUD_PRINTTALK,"You're in the SG Team."); 
	
  else

 
  if( pl:Team( GENII )) then
  pl:PrintMessage(HUD_PRINTTALK,"You're a Genii.")
 
  else

  
  if( pl:Team( REPLICATOR )) then
  pl:PrintMessage(HUD_PRINTTALK,"You're a Replicator.")
  end
  end
	end
	end
	end
	end
/*----------------------------------------------------------------------
	Sets Admin Teams
*/----------------------------------------------------------------------
  
function AdminTeamSet(ply) // This makes it if the player is admin they are an ancient
  if( ply:IsAdmin() ) then 
	ply:StripWeapons() // Fixes a bug where they got all the other weapons from the other teams
	ply:SetTeam( ANCIENT )
	end
end 

 
function GM:PlayerLoadout(ply)
  return
end

function GM:PlayerSpawn(ply)
  self.BaseClass:PlayerSpawn(ply)
  if( ply:IsAdmin() ) then
	ply:SetTeam( ANCIENT )
	ply:SetHealth(1000)
	ply:Give("weapon_minidrone")
	ply:Give("weapon_dexgun")
	ply:Give("weapon_physgun")
	ply:Give("gmod_tool")
	ply:Give("weapon_staff")
	ply:Give("weapon_zat")
	end
  
  if ply:Team() == SG_TEAM then
    ply:Give("P90") 
    ply:Give("weapon_dexgun")
    ply:Give("weapon_physgun")
    ply:Give("weapon_physcannon")
    ply:Give("gmod_tool")	
  end
    
    if ply:Team() == WRAITH then
    ply:SetHealth(200)
	ply:Give("weapon_zat") 
    ply:Give("weapon_physgun")
    ply:Give("weapon_physcannon")
    ply:Give("gmod_tool")
    end

	if ply:Team() == SPECTATE then
	ply:PrintMessage(HUD_PRINTTALK,"Welcome to AtlantisRP! Join a Team and enjoy!");
	end
	
	if ply:Team() == GENII then
	ply:Give("weapon_physgun")
	ply:Give("weapon_smg1")
	ply:Give("weapon_shotgun")
	ply:Give("weapon_pistol")
	ply:Give("gmod_tool")
	end
	
	if ply:Team() == REPLICATOR then
	ply:SetHealth( 500 )
	ply:Give("sodan_cloak")
	ply:Give("weapon_dexgun")
	ply:Give("weapon_physgun")
	ply:Give("weapon_physcannon")
	ply:Give("gmod_tool")
	ply:Give("weapon_hand_device")
	end
	
/*--------------------------------------------------------------
	Disables no clip accept if they're admins
*/----------------------------------------------------------------

local function DisableNoclip( objPl )
		return objPl:Team( ANCIENT )
	end
end

/*---------------------------------------------------------
   Friendly Fire is off by default
---------------------------------------------------------*/

function GM:PlayerShouldTakeDamage(victim,attacker)
	if attacker:IsValid() and attacker:IsPlayer() and (victim:Team() == attacker:Team() and server_settings.Bool( "mp_friendlyfire" ) == false) then
		return false
	else
		return true
	end
end


